package com.kaitian.demo.demo_boot_starter.validator;

import com.kaitian.demo.demo_boot_starter.dto.DemoDO;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

/**
 * @author ：xietian
 * @version ：V1.0
 * @program ：demo
 * @date ：Created in 2022/4/11 15:55
 * @description ： Demo的自定义验证工具，用于处理简单注解验证无法搞定的事情
 */
public class DemoValidator implements Validator {

    @Override
    public boolean supports(Class<?> aClass) {
        // 根据类比较说明应用范围
        return aClass.equals(DemoDO.class);
    }

    @Override
    public void validate(Object o, Errors errors) {
        // 此处写验证逻辑
    }
}